package com.hf.servlet;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.hf.dao.OrderDao;
import com.hf.entity.Order;

@WebServlet("/od.do")
public class OrderServlet extends HttpServlet{ 
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
	doPost(req, resp);
	}
	
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
			
		
			  HttpSession session = req.getSession();
		      OrderDao orderdao = new OrderDao();
		      Order order= new Order();
		      int user_id=0;
		      user_id= (Integer) session.getAttribute("user_id");
		      List<Order>  list=  orderdao.selectOder(user_id);
		      if(user_id!=0){
		    	  int ont1 = orderdao.ontContent();
			      session.setAttribute("ont1", ont1);
			      int already=orderdao.AlreadyContent();
			      session.setAttribute("already", already);
			      int wait=orderdao.waitContent();
			      session.setAttribute("wait", wait);
			      int evaluate=orderdao.evaluateContent();
			      session.setAttribute("evaluate",evaluate);
			      session.setAttribute("list", list);
			    
		     	}
		     req.getRequestDispatcher("my_order/wodedingdan.jsp").forward(req, resp); 
		    
			}

		}
